class CnAnchorModel {
  String userId = ""; // 用户id
  String nickname = ""; // 昵称
  String avatar = ""; // 头像
  String avatarMapPath = "";
  int gender; // 性别
  int age; // 年龄
  String activityTagUrl = "";
  String country = ""; // 国家
  String status = ""; // 状态，在线/离线/忙碌
  int callCoins; // 通话价格
  String unit; // 价格单位
  // List<String> videoMapPaths = []; // 视频相对路径集合
  int followNum; // follow数量
  bool isMultiple;
  List<String> imageMapPaths = []; // 图片相对路径集合
  bool isFollow = false; //是否已经关注

  CnAnchorModel({
    required this.age,
    required this.avatar,
    required this.avatarMapPath,
    required this.callCoins,
    required this.country,
    required this.followNum,
    required this.gender,
    required this.isMultiple,
    required this.nickname,
    required this.status,
    required this.unit,
    required this.userId,
    required this.activityTagUrl,
    required this.isFollow,

    // required this.videoMapPaths,
    required this.imageMapPaths,
  });

  factory CnAnchorModel.coverFromJson(dynamic anchorData) => CnAnchorModel(
      age: anchorData['age'] ?? 0,
      avatar: (anchorData['avatar'] is String) ? anchorData['avatar'] : "",
      activityTagUrl: (anchorData['activityTagUrl'] is String)
          ? anchorData['activityTagUrl']
          : "",
      avatarMapPath: (anchorData['avatarMapPath'] is String)
          ? anchorData['avatarMapPath']
          : "",
      callCoins: anchorData['callCoins'] ?? 0,
      country: anchorData['country'] ?? "",
      followNum: anchorData['followNum'] ?? 0,
      gender: anchorData['gender'] ?? 1,
      isMultiple: anchorData['isMultiple'] ?? false,
      nickname: anchorData['nickname'] ?? "",
      status: anchorData['status'] ?? "",
      unit: anchorData['unit'] ?? '',
      userId: anchorData['userId'] ?? "",
      isFollow:false,
      imageMapPaths: anchorData['imageMapPaths']!=null?anchorData['imageMapPaths'].split(',') ?? []:[],
      // videoMapPaths: (anchorData['videoMapPaths'] as List<dynamic>)
      //     .map((data) => data.toString())
      //     .toList()
          );
}
